Skip to main content link. Accesskey S
  • Help
  • HCL Logo
  • HCL Sametime wiki
  • THIS WIKI IS READ-ONLY. Individual names altered for privacy purposes.
  • HCL forums and blogs
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
Search
Community Articles > Sametime Unified Telephony > Internet Explorer extension for Click-to-Call
  • Share Show Menu▼
  • Subscribe Show Menu▼

Recent articles by this author

Creating a customer service web application using Sametime - Part Three

Support Click-to-Chat with only a little coding: The Click-to-Chat pattern is becoming increasingly popular on customer-facing web sites. This series of three articles shows how to implement this using the Sametime Proxy features, with a simple automation servlet, or bot to manage ...

Creating a customer service web application using Sametime - Part Two

Support Click-to-Chat with only a little coding: The Click-to-Chat pattern is becoming increasingly popular on customer-facing web sites. This series of three articles shows how to implement this using the Sametime Proxy features, with a simple automation servlet, or bot to manage ...

Creating a customer service web application using Sametime - Part One

Support Click-to-Chat with only a little coding: The Click-to-Chat pattern is becoming increasingly popular on customer-facing web sites. This series of three articles shows how to implement this using the Sametime Proxy features, with a simple automation servlet, or bot to manage ...

Google Chrome extension for Click-to-Call

Make phone calls from any web page: This article describes an extension to the Google Chrome™ browser to allow highlighted phone numbers on an arbitrary web page to be called from Sametime Unified Telephony.

Internet Explorer extension for Click-to-Call

Make phone calls from any web page: This article describes an extension to Microsoft Internet Explorer™ to allow highlighted phone numbers on an arbitrary web page to be called from Sametime Unified Telephony.
Community articleInternet Explorer extension for Click-to-Call
Added by ~Vanessa Reachek | Edited by ~Fritz Lopboositherli on May 10, 2013 | Version 8
  • Actions Show Menu▼
expanded Abstract
collapsed Abstract
Make phone calls from any web page: This article describes an extension to Microsoft Internet Explorer™ to allow highlighted phone numbers on an arbitrary web page to be called from Sametime Unified Telephony.
ShowTable of Contents
HideTable of Contents
  • 1 Overview
  • 2 Installation and removal
  • 3 How does it work?
  • 4 Requirements
  • 5 Conclusion
  • 6 Download
  • 7 Resources
  • 8 About the author

Overview


The IBM® Sametime® Connect client allows users to make telephone calls via IBM Sametime Unified Telephony (SUT). This functionality can be called from a browser, allowing its integration directly into the browser's default functionality. This article shows how to create such an extension and how to install it into Internet Explorer.

This extenson adds a new menu item to the Internet Explorer context menu. After installing, when you highlight a phone number on a web page, you can right-click on the highlighted area and select the “Phone” item. The number will then be called using Sametime Unified Telephony functions in your Sametime client.



Installation and removal


To install the extension is quite simple. Download the attached zip file, and extract its contents. Then run the install.bat batch file, either from the command line or by double-clicking from Windows Explorer. When the process is complete the batch file will wait for you to press Enter to allow it to finish. The functionality will become available when you next start Internet Explorer.

Removing the extension is equally straightforward. Run the uninstall.bat file, again either from the command line or by double-clicking. When the process is complete the batch file will wait for you to press Enter to allow it to finish. If Internet Explorer is running, the uninstall process will not be complete until you next exit the browser.

How does it work?


There are two parts to the extension. The first is to tell Internet Explorer where it should find the code, and this is done by adding a new key to the Microsoft Windows registry, along with two parameters. This can be seen in the install.reg file:

	[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Phone] 

	@="C:\\Program Files\\Internet Explorer\\Plugins\\SUTPhone.htm" 

	"Contexts"=dword:00000010

	

Here we add the Phone key to the MenuExt set of keys for Internet Explorer, and we tell it the location of the code file. Additionally, the Contexts parameter is set to the value 0x10 to indicate that this extension should be executed for hightlighted text in a web page.

The code itself is simply an HTML file with a single JavaScript which is the code executed when the menuitem Phone is clicked. The first thing it does is pick up the text that is highlighted:

Listing 1: Extract the highlighted string

	var parentwin = external.menuArguments;

	var doc = parentwin.document;

	var sel = doc.selection;

	var rng = sel.createRange();

	var str = new String(rng.text);

	

Once we have the string, in our example code we use pattern-matching to reformat the string into an all-numeric value that can be dialled. The example even replaces an initial “+” with the US international dial code of “011” which means that if this sample is used in other countries, the dial code should be changed as appropriate, e.g. to “00” in Europe. Note that this is not necessary: SUT is quite capable of extracting a number correctly without this manipulation.



Listing 2: Reformat the selected string into a numeric value

 var phoneRegex = /^[\s]*((\+|00|011)[-\s]*[\d]{1,3}[-\s]*)?(\(\d{1,4}\)[-\s]*)?([\d\s]{1,14})$/;

	

	// This function generates a phone number which contains only digits

	function validateNum(str) {

	// Apply the regex

	var num = phoneRegex.exec(str);

	if (!num) // No match!

	return null;

	

	// 1=Intl code, 2=Intl prefix, 3=area code, 4=number

	if (num[1] && num[2]) {

	// This replaces “+” with US dial

	num[1] = num[1].replace(num[2], "011").replace(/ /g, "");

	} else {

	num[1] = "";

	}

	if (num[3]) {

	num[3] = num[3].replace("(0)","").replace(/[() ]/g,"");

	} else {

	num[3] = "";

	}

	num[4] = num[4].replace(/ /g,"");

	return num[1] + num[3] + num[4];

	}

	

Finally, if the string is identified as being a phone number, it passes it to SUT. We use a trick here to allow JavaScript to run without causing any cross-domain issues. The URL of the REST API in the Sametime Connect client is used as the src= parameter of an HTML image, causing that address to be called, resulting in the SUT API being executed and the call is placed as required.



Listing 3: Making the call


	image = new Image();

	

	// To make a call using local sametime client, force access using image src

	image.src = "http://localhost:59449/stwebapi/call?number=" + SUTNum;

	

	// Prevent leaks

	image = null;

	

Requirements


There are a number of requirements for the extension to function as required:

  • You must have administrator rights to install or uninstall the plugin. Also, you must run install/uninstall from the directory where you extracted the files. 
  • You must have the Sametime Connect client running and be logged in to Sametime.
  • You must have SUT installed and configured correctly.
  • You must enable access to the WebConnect API in the Sametime client.
  • This only works with Internet Explorer 8 or later.

The Sametime Connect Web API may be disabled by default. To see the current state of each function, login to Sametime and go to http://localhost:59449/stwebapi/listservices in your browser. Functions that are disabled can be enabled by adding a preference to the file plugin_customization.ini in {Notes Install Directory}\framework\rcp if using the embedded client, or {Sametime Install Directory}\rcp if you have the Sametime Connect client, using the following format:

 

com.ibm.collaboration.realtime.webapi.Enabled=true

For example, to enable the call function you would add this preference:

com.ibm.collaboration.realtime.webapi.callEnabled=true

To enable all Web API functions you can use the global override:

com.ibm.collaboration.realtime.webapi/enableAllWebApisOverride=true
 

 

Conclusion

When browsing the web, you can now make a phone call to a number which is on any web page with very little effort, enhacing your browsing experience by improved integration of Sametime into Internet Explorer.

Download

Sample code discussed here is attached to the article. Expand the "Attachments" section below to download the zip file.

Resources


• developerWorks® IBM Sametime product page:
• http://www.ibm.com/developerworks/lotus/products/instantmessaging/
• Community article “Firefox Plugin for Click to Call”:
• http://www-10.lotus.com/ldd/stwiki.nsf/dx/Firefox_Plugin_for_Click_to_Call
• MSDN article “Creating Add-ons for Internet Explorer: Customizing Menus”:
• http://msdn.microsoft.com/en-us/library/bb735853%28v=vs.85%29.aspx

About the author



Brendan Murray joined Lotus Development in 1991 and was acquired, along with the rest of the company, by IBM in 1995. Most recently he has been working on Sametime with a particular emphasis on its Web functionality. You can reach him at brendan_murray@ie.ibm.com.


  • Actions Show Menu▼


expanded Attachments (1)
collapsed Attachments (1)
Edit the article to add or modify attachments.
File TypeSizeFile NameCreated OnDelete file
application/x-zip 5 KB SUTPhone.zip 3/25/13, 5:27 PM
expanded Versions (8)
collapsed Versions (8)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (8)May 10, 2013, 12:27:35 PM~Fritz Lopboositherli  Clarified requirements
7Apr 24, 2013, 4:36:52 PM~Andy Ciskrogengon  Clarify installation requirements
6Apr 24, 2013, 11:10:45 AM~Andy Ciskrogengon  
5Apr 11, 2013, 9:30:56 AM~Andy Ciskrogengon  Reformatted bulleted list
4Apr 2, 2013, 2:25:53 PM~Sarah Brewevitchynds  
3Apr 2, 2013, 2:02:43 PM~Sarah Brewevitchynds  
2Apr 2, 2013, 1:58:36 PM~Sarah Brewevitchynds  
1Apr 2, 2013, 1:56:33 PM~Sarah Brewevitchynds  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedAbout
  • HCL Software
  • HCL Digital Solutions community
  • HCL Software Support
  • BlogsDigital Solutions blog
  • Community LinkHCL Software forums and blogs
  • About HCL Software
  • Privacy
  • Accessibility